package com.nuedu.corejava.ch5;

import java.util.Scanner;

public class Recursion1 {
	public int sum (int num,int sum){
		
		sum*=num--;
		if (num==0) {
			return sum;
		}else {
			return sum(num, sum);
		}
	}
	public static void main(String[] args) {
		Recursion1 re=new Recursion1();
		Scanner scanner=new Scanner(System.in);
		System.out.println("请输入一个大于0的整数");
		
		int a=scanner.nextInt();
		int result =re.sum(a, 1);
		System.out.println(result);
	}

}
